package com.bazhua.bazo.common.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @Author: starmile
 * @Description:
 * @Create: 2021-01-25 23:02
 **/
public class CodeUtil {

    public static String createCode() {
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str = format.format(date);
        Date orderId = null;
        Random rand = new Random();
        //[900]：900个    100：从100
        int x = rand.nextInt(900) + 100;
        try {
            orderId = format.parse(str);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return String.valueOf(orderId.getTime()) + x;

    }
}
